#!/user/bin/env python3
#! -*- coding: utf-8 -*-
__author__ ="jzp";

import re;

'''
python练习
'''

# ======== 数据类型 ========
# s = input();
# print(s);

# ======== 数据类型 ========#
a = 231;
print("a的值是 %d,其类型是 %s"%(a,type(a)))
a = 231.442;
print("a的值是 %f,其类型是 %s"%(a,type(a)))
a = True;
print("a的值是 %s,其类型是 %s"%(a,type(a)))
a = 4 + 2j;
print("a的值是 %s,其类型是 %s"%(a,type(a)))
a = "asdasfasfsa";
print("a的值是 %s,其类型是 %s"%(a,type(a)))
a = ["asda",True,None,12,23.32,12];
print("a的值是 %s,其类型是 %s"%(a,type(a)))
a = ("asda",True,None,12,23.32,12);
print("a的值是 %s,其类型是 %s"%(a,type(a)))
a = {"name":"jzp","age":21};
print("a的值是 %s,其类型是 %s"%(a,type(a)))
a = {"name","jzp","age","age"};
print("a的值是 %s,其类型是 %s"%(a,type(a)))
a = None;
print("a的值是 %s,其类型是 %s"%(a,type(a)))


# ======== 运算符========
print((34 + 22.33) / 5);
print(5 % 2);
print(5 // 2);
print(True and True);
print(True or False);
print(not False);


# ==========ASCⅡ=========
print(ord("a"));
print(chr(98));


# ==========encode && encode=====
print("cdsac".encode("ASCII"));
print("中文".encode("utf-8"));
print(b'cdsac'.decode("ASCII"));


# =============string=========
print("Hi %s 你好" % "jzp");
# *同学你好，在*学期，你的成绩是*，提升了*%
print("%s同学你好，在%02d学期，你的成绩是%.2f,提升了%.2f%%" %("jzp",2,99.51,114.514))
print(len("cdasca"));
print(len("中文"));
print(len("中文".encode("utf-8")));
print("usvb".find("v"));



# ===========正则表达式=========
print(re.match("j","ajzp"));#搜第一个字母
print(re.search("j","jzp"));#搜全文
# 截至5月9日，新冠病毒累计确诊人数为234例(其中海外输入77例),累计治愈456例，死亡4例，住院观察45例
pa="新冠病毒累计确诊人数为(\d+)例（其中海外输入(\d+)例），累计治愈(\d+)例，死亡(\d+)例，住院观察(\d+)例";
ta="截至5月9日，新冠病毒累计确诊人数为234例（其中海外输入77例），累计治愈456例，死亡4例，住院观察45例";
ma=re.search(pa,ta);
if ma:
    print(ma.group());
    print(ma.group(0));
    print(ma.group(1));
    print(ma.group(2));

pa='<link rel="cannonical" href="(.*?)"/>';
ta='<link rel="cannonical" href="https://gitee.com/akulaowo/gongcheng"/>';
result= re.findall(pa,ta);
print(result);

#===== list =====
l=["dsa",32,34.44,None,True,32];
print(l);

l=list(range(1,10));
print(l);
#["'index_1","index_2",...]
l=list("https://www.sacf.xyz/library/novel/%d"%i for i in range(1,10));
print(l);
l=list(range(1,10));
l.append(10);
print(l);
l.pop();
print(l);
l.pop(0);
print(l);
l.remove(9);
print(l);
l1=["Sea",23];
l.append(l1);
print(l);
l+=l1;
print(l);
print(l[0]);

#===== tuple =====
t= tuple(range(1,10));
print(t);
t=("AK47",32,34.44,None,True,32,["P90","MP9"]);
print(t);
t[6][0]="M14EBR";
print(t);

#===== dict =====
d={"name":"Scar","age":18,"gender":"weapon"};
print(d);
print(d.keys());
print(d.values());
print(d["name"]);
print(d.get("name1","AT-4"));
d["aaa"]="bbb";
print(d);
d2={"ccc":"ddd","eee":"fff"};
print(dict(d,**d2));
d.pop("aaa");
print(d);

# =========== set ======




#========循环;
age=21;
if age <=18:
    print("小逼登");
elif age>18 and age<=61:
    print("中逼登");
else:
    print("老毕等");

l = list(range(1,10));
for i in l:
    print(i);

i=0;
while i<10:
        print(i);
        i=i+1;

a="study" if age <= 18 else "work";
print(a);

#变量
#_a ="sfewfew";
#__a ="dsfsd";#全局变量
#HUMAN_NAME = "esfeferger";

#内键作用于











